<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib prefix="sec"
	uri="http://www.springframework.org/security/tags"%>
<%@ page import="static com.gmail.avereshchaga.tools.UrlList.*"%>
<%@ page session="true"%>
<html>
<head>
<link rel="stylesheet" href="<%=request.getContextPath()%>/themes/default.css" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/<spring:theme code="css"/>" type="text/css" />
<title>Log In</title>
</head>
<body>

    <span style="float: right">
        <a href="?lang=en">En</a>
        <a href="?lang=ru">Ru</a>
    </span> 
    <br />
    <span style="float: right">
        <a href="?theme=red">Red Theme</a>
        |
        <a href="?theme=green">Green Theme</a>
    </span>
        <h1>Horns and Hooves</h1>
    <br />
    
	<hr color="gray" noshade size="1">
	<table cellspacing="20">
		<tr>
			<td><a href="<%=request.getContextPath()%>"><spring:message code="label.home"/></a></td>
			<sec:authorize access="isAuthenticated()">
				<td><a href="<%=request.getContextPath()%>/<%=EMPLOYEE_CREATE_URL%>"><spring:message code="label.create.employee"/></a></td>
				<td><a href="<%=request.getContextPath()%>/<%=DIVISION_LIST_URL%>"><spring:message code="label.divisions.list"/></a></td>
				<td><a href="<%=request.getContextPath()%>/<%=DIVISION_CREATE_URL%>"><spring:message code="label.create.division"/></a></td>
			</sec:authorize>
		</tr>
	</table>

	<hr color="gray">
	<br />

	<form class="login-form" action="j_spring_security_check" method="post">
		<table align="right" cellspacing="10">
			<sec:authorize access="isAuthenticated()">
				<tr>
					<td><spring:message code="label.welcome"/>, <sec:authentication property="principal.username" />!
					</td>
				</tr>
			</sec:authorize>
			<sec:authorize ifNotGranted="ROLE_ADMIN">
				<tr>
					<td><spring:message code="label.welcome"/>, <sec:authentication property="principal" />!
					</td>
				</tr>
				<tr>
					<td><b><spring:message code="label.authorization"/>: </b></td>
				</tr>
				<tr>
					<td><label for="j_username"><spring:message code="label.login"/>: </label></td>
					<td><input id="j_username" name="j_username" size="20"
						maxlength="50" type="text" /></td>
				</tr>
				<tr>
					<td><label for="j_password"><spring:message code="label.password"/>: </label></td>
					<td><input id="j_password" name="j_password" size="20"
						maxlength="50" type="password" /></td>
				</tr>
				<tr>
					<td><input type="submit" value="<spring:message code="label.log.in"/>" /></td>
				</tr>
			</sec:authorize>
			<sec:authorize access="isAuthenticated()">
				<tr>
					<td><a href="<%=request.getContextPath()%>/<%=LOGOUT_URL%>"><font SIZE=+1><spring:message code="label.exit"/></font></a></td>
				</tr>
			</sec:authorize>
		</table>
	</form>
</body>
</html>